

*** Table 1 ***


clear all

*Set the folder
cd ""

use Ernest_China_dataset_correct.dta, clear


*** Panel A

*counties with mw change Treated
est clear
estpost tabstat hrs if year==2002 & emwch==1,  statistics(mean sd)  columns(statistics)
est store m1
estpost tabstat hrs if year==2003 & emwch==1,  statistics(mean sd)  columns(statistics)
est store m2
estpost tabstat hrs if year==2004 & emwch==1,  statistics(mean sd)  columns(statistics)
est store m3
estpost tabstat hrs if year==2005 & emwch==1,  statistics(mean sd)  columns(statistics)
est store m4
estpost tabstat hrs if year==2006 & emwch==1,  statistics(mean sd)  columns(statistics)
est store m5

esttab m1 m2 m3 m4 m5 using "hrs_emwch1.tex", label style(tex) delim("&") main(mean) aux(sd) nostar parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{5}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 

* county with no change in mw Control
est clear
estpost tabstat hrs if year==2002 & emwch==0,  statistics(mean sd)  columns(statistics)
est store m1
estpost tabstat hrs if year==2003 & emwch==0,  statistics(mean sd)  columns(statistics)
est store m2
estpost tabstat hrs if year==2004 & emwch==0,  statistics(mean sd)  columns(statistics)
est store m3
estpost tabstat hrs if year==2005 & emwch==0,  statistics(mean sd)  columns(statistics)
est store m4
estpost tabstat hrs if year==2006 & emwch==0,  statistics(mean sd)  columns(statistics)
est store m5

esttab m1 m2 m3 m4 m5 using "hrs_emwch0.tex", label style(tex) delim("&") main(mean) aux(sd) nostar parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{5}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 


*t-test
est clear
reg hrs emwch if year==2002, vce(cluster  countyid)
est store m1
reg hrs emwch if year==2003, vce(cluster  countyid)
est store m2
reg hrs emwch if year==2004, vce(cluster  countyid)
est store m3
reg hrs emwch if year==2005, vce(cluster  countyid)
est store m4
reg hrs emwch if year==2006, vce(cluster  countyid)
est store m5
	
esttab m1 m2 m3 m4 m5 using "hrs_county_means.tex", label style(tex) delim("&") cells(b(fmt(a3) star) se) stats(N) star(* 0.10 ** 0.05 *** 0.01) parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{5}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 



*** Panel B

** MW Households
*counties with mw change
est clear
estpost tabstat hrs if year==2002 & emwch==1 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m1
estpost tabstat hrs if year==2003 & emwch==1 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m2
estpost tabstat hrs if year==2004 & emwch==1 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m3
estpost tabstat hrs if year==2005 & emwch==1 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m4
estpost tabstat hrs if year==2006 & emwch==1 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m5

esttab m1 m2 m3 m4 m5 using "hrs_mwhh_emwch1.tex", label style(tex) delim("&") main(mean) aux(sd) nostar parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{5}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 



* county with no change in mw
est clear
estpost tabstat hrs if year==2002 & emwch==0 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m1
estpost tabstat hrs if year==2003 & emwch==0 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m2
estpost tabstat hrs if year==2004 & emwch==0 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m3
estpost tabstat hrs if year==2005 & emwch==0 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m4
estpost tabstat hrs if year==2006 & emwch==0 & hMWshare>0,  statistics(mean sd)  columns(statistics)
est store m5

esttab m1 m2 m3 m4 m5 using "hrs_mwhh_emwch0.tex", label style(tex) delim("&") main(mean) aux(sd) nostar parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{5}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 



*t-test
est clear
reg hrs emwch if year==2002 & hMWshare>0, vce(cluster  countyid)
est store m1
reg hrs emwch if year==2003 & hMWshare>0, vce(cluster  countyid)
est store m2
reg hrs emwch if year==2004 & hMWshare>0, vce(cluster  countyid)
est store m3
reg hrs emwch if year==2005 & hMWshare>0, vce(cluster  countyid)
est store m4
reg hrs emwch if year==2006 & hMWshare>0, vce(cluster  countyid)
est store m5
	
esttab m1 m2 m3 m4 m5 using "hrs_county_mwhh_means.tex", label style(tex) delim("&") cells(b(fmt(a3) star) se) stats(N)  parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{5}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 





*** Panel C: MW Bite

clear all

*Set the folder where data are
cd ""

use B2_correct,clear

*drop HH and workers observed only once
drop if honeobsfyr==1
drop if wnyrsp==1

bysort dhcode year: gen counter = _n == 1   // create a dummy variable 1 for first HH obs in a year, 0 otherwise
by dhcode: replace counter = sum(counter)     // sum the 1s and 0s only within HH, hence the first year that first member in HH is observed is 1, the second year is 2 etc
by dhcode: egen hhnyrsp = max(counter)     //  within HH replaces all values with the highest to give the HH number of years in the UHS
label var hhnyrsp "HH total number of years in UHS panel"
tab hhnyrsp 
drop if hhnyrsp==1


drop if hMWshare==.

est clear
estpost tabstat mwbite if year==2002,  statistics(mean sd)  columns(statistics)
est store m1
estpost tabstat mwbite if year==2003,  statistics(mean sd)  columns(statistics)
est store m2
estpost tabstat mwbite if year==2004,  statistics(mean sd)  columns(statistics)
est store m3
estpost tabstat mwbite if year==2005,  statistics(mean sd)  columns(statistics)
est store m4
estpost tabstat mwbite if year==2006,  statistics(mean sd)  columns(statistics)
est store m5
estpost tabstat mwbite if year==2007,  statistics(mean sd)  columns(statistics)
est store m6
estpost tabstat mwbite if year==2008,  statistics(mean sd)  columns(statistics)
est store m7
estpost tabstat mwbite if year==2009,  statistics(mean sd) columns(statistics)
est store m8

esttab m1 m2 m3 m4 m5 m6 m7 m8 using "mw_bite.tex", label style(tex) delim("&") main(mean) aux(sd) nostar parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{8}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006" "2007" "2008" "2009") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 





*** Panel C: MW Growth

clear all
cd ""

*** Replace MW county data with city or province when possible 
use minwage2_county2
ren county countyid
gen cityid=int(countyid/100)
move cityid countynm
joinby cityid year using "minwage2_city.dta", unmatched(master) update _merge(_merge1)
gen provid  = int(cityid/100)
move provid countynm
joinby provid year using "minwage2_prov.dta", unmatched(master) update _merge(_merge2)
drop countynm name
drop _merge1 _merge2

*** merge with CPI and labr dispute cases
sort provid year
joinby provid year using "prov_cpi_lbcases.dta", unmatched(master)
drop _merge


gen effrealmw=mwminiwage*12/cpiindex   // annual real effective minimum wage in 2002 yuan

xtset countyid year
bysort countyid: gen erealmwgr = (effrealmw-l.effrealmw)/effrealmw * 100
tab year if erealmwgr==.


est clear
estpost tabstat erealmwgr if year==2002,  statistics(mean sd)  columns(statistics)
est store m1
estpost tabstat erealmwgr if year==2003,  statistics(mean sd)  columns(statistics)
est store m2
estpost tabstat erealmwgr if year==2004,  statistics(mean sd)  columns(statistics)
est store m3
estpost tabstat erealmwgr if year==2005,  statistics(mean sd)  columns(statistics)
est store m4
estpost tabstat erealmwgr if year==2006,  statistics(mean sd)  columns(statistics)
est store m5
estpost tabstat erealmwgr if year==2007,  statistics(mean sd)  columns(statistics)
est store m6
estpost tabstat erealmwgr if year==2008,  statistics(mean sd)  columns(statistics)
est store m7
estpost tabstat erealmwgr if year==2009,  statistics(mean sd) columns(statistics)
est store m8

esttab m1 m2 m3 m4 m5 m6 m7 m8 using "mw_gr.tex", label style(tex) delim("&") main(mean) aux(sd) nostar parentheses unstack noobs nonumbers  ///
prehead("\begin{table}[tbhp] \centering {\begin{tabular}{l*{8}{c}}" \hline) ///
collabels( , none)  mtitle("2002" "2003" "2004" "2005" "2006" "2007" "2008" "2009") prefoot( \hline) postfoot( \hline "\end{tabular} } \end{table} ") replace 


